<%@ page language="java" import="java.util.*,cn.bupt.adt.constant.Constants" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page  isELIgnored="false"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	//分页
	//currentPage就是当前页，allPages表示的就是一共有多少页。这些在后面都会用到  
	int currentPage = 0, allPages = 0;
	if (request.getAttribute("currentPage") != null) {
		currentPage = Integer.parseInt(request.getAttribute(
				"currentPage").toString());
	}
	if (request.getAttribute("allPages") != null) {
		allPages = Integer.parseInt(request.getAttribute("allPages")
				.toString());
	}
	//本页面url，翻页用
	String url = "orderManagement/finished";
	request.setAttribute("url", url);
%>
<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title></title>
    

	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/bootstrap.min.css" />

    <link href="<%=request.getContextPath()%>/assets/css/font-awesome.css" rel="stylesheet" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
	<script src="<%=request.getContextPath()%>/assets/js/jquery-1.10.2.js" type="text/javascript"></script>
	<script  type="text/javascript" src="js/layer/layer.js" ></script>
	<script src="assets/js/bootstrap.js"></script>
	<link rel="stylesheet" href="layerui/css/layui.css"><link>
	<link rel="stylesheet" href="css/Orderfont.css"><link>
	<script type="text/javascript" src="layerui/layui.js"></script>
	  </head>
  <c:if test="${!empty oper_message }">
  	<script type="text/javascript">
  		alert("${oper_message}");
  	</script>
  </c:if>
  <body>
		  <div class="page-header">
		  		<h1><small>已完成订单<i class="icon-double-angle-right"></i></small></h1>
			</div>
  	<div class="container">
	<div class="table-responsive">
		<table class="table table-striped table-hover ">
			<thead >
				<tr class="center">
					<th>id</th>
					<th>订单状态</th>
					<th>发布机构</th>
					<th>机构电话</th>
					<th>接单医生</th>
					<th>医生电话</th>
					<th>发布时间</th>
					<!-- <th>完成时间</th> -->
					<th>金额</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody >
			<c:forEach items="${orders}" var="item">

     	
				<tr class="center">
					<td><span>${item.id}</span></td>
					<td>
						<c:choose>
							<c:when test="${item.status == 6 }">
								<span class="label label-sm label-success">完成订单</span>
							</c:when>
						</c:choose>
					</td>
					<td><span>${item.institutionName}</span> </td>
					<td><span>${item.phone}</span> </td>
					<td><span>${item.doctorName }</span> </td>
					<td>
						<c:choose >
							<c:when test="${item.doctorPhone == NULL }">
								<span>无</span>
							</c:when>
							<c:otherwise>
								<span>${item.doctorPhone}</span>
							</c:otherwise>
						</c:choose>
					</td>				
					<td>
					<span>
						<fmt:formatDate value="${item.publicTime}" pattern="yyyy-MM-dd HH:mm:ss"/> 
					</span>
					</td>
					
<%-- 					<td>
					<span>
						<fmt:formatDate value="${item.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/> 
					</span> 
					</td> --%>
					
					<td><span>${item.money}</span> </td>
					
					<td>
						<a title="查看详情" href="orderManagement/finishDetail/${item.id}">查看</a>
					</td>
					
				</tr>			
			</c:forEach>

			</tbody>
			<tfoot>
				<tr>
					<td colspan="10" style="text-align:left">
			     	<c:if test="${allPages>1}">
			     	<ul class="pagination">
			     		<li ><a href="${url}/1">首页</a></li>
			     		<li><a href="javascript:void(0)" id="previous" onclick="dividePage('${url}','previous')">&laquo;</a></li>
			     		<c:forEach var="item" begin="1" end="${allPages }" varStatus="idx">
						  	<c:choose>
						  		<c:when test="${idx.index == currentPage }">
						  			<li class="active"><a href="javascript:void(0)" id="active">${idx.index}</a></li>
						  		</c:when>
						  		<c:otherwise>
						  			<li><a href="${url}/${idx.index}">${idx.index}</a></li>
						  		</c:otherwise>
						  	</c:choose>
						  </c:forEach>
					      <li><a href="javascript:void(0)" id="next" onclick="dividePage('${url}','next','${allPages}')">&raquo;</a></li>
			     			<li ><a href="${url}/${allPages}">尾页</a></li>
					</ul>			     	
			     	</c:if>
			     	
					
					</td>
				</tr>
			</tfoot>
		</table>
   	      	
	</div>
	</div>
	<script type="text/javascript" src="js/public/dividePage.js"></script>
  </body>
</html>